package ch03.test.factory;

import ch03.test.dao.ComputeDao;
import ch03.test.dao.impl.*;

import static ch03.test.utils.Compute.*;

public class ComputeDaoFactory {
    public static ComputeDao getInstance(String key){
        switch (key){
            case Compute_Add:
                return new ComputeAddDaoImpl();
            case Compute_Addition:
                return new ComputeAdditionDaoImpl();
            case  Compute_Reduction:
                return new ComputeReductionDaoImpl();
            case Compute_Take:
                return new ComputeTakeDaoImpl();
            case Compute_Remainder:
                return new ComputeRemainderDaoImpl();
            default:
                throw new RuntimeException("输入的运算符有误");
        }
    }
}
